package com.chezhujie.www.service;

import com.chezhujie.www.domain.Czjotherurl;
import com.chezhujie.www.persistence.CzjotherurlMapper;
import com.xy.core.page.Pagination;
import com.xy.core.utils.UUIDUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class CzjotherurlService {


    @Autowired
    private CzjotherurlMapper czjotherurlMapper;

	public void svse(Czjotherurl czjotherurl) {
			
		if(StringUtils.isBlank(czjotherurl.getOtherurlId())){
			czjotherurl.setOtherurlId(UUIDUtils.getUUID());
		}
		
		czjotherurlMapper.insertCzjxyotherurl(czjotherurl);
	}

	public Pagination listCzjotherurl(Map<String, Object> map,
									  Integer pageSize, Integer pageNo) {
		Pagination p = new Pagination();
		p.setPageNo(pageNo);
		p.setPageSize(pageSize);
		map.putAll(p.toMap());
		int count=czjotherurlMapper.getTotalotherurl(map);
		List<Czjotherurl> list=	czjotherurlMapper.listCzjotherurl(map);
	
		p.setList(list);
		p.setTotalCount(count);
		return p;
	}

	public Pagination getOtherDetailByType(Map<String, Object> map,
			Integer pageSize, Integer pageNo) {
		Pagination p = new Pagination();
		p.setPageNo(pageNo);
		p.setPageSize(pageSize);
		map.putAll(p.toMap());
		int count=czjotherurlMapper.getTotalByType(map);
		List<Czjotherurl> list=	czjotherurlMapper.getOtherDetailByType(map);
	
		p.setList(list);
		p.setTotalCount(count);
		return p;
	}

	


}
